package system.wrap_filter;

import java.util.Date;

import system.events.EventType;

public class Standard {
	private long timeStamp;
	private EventType type;
	private String state;
	private int[] position;
	private int temperature;
	private String subtype;
	private String message;
	private String attribute;
	private String source;
	private boolean notified;
	private Date date;

	public Standard(long timeStamp, EventType type, String state,
			int[] position, int temperature, String subtype, String message,
			String source) {
		this.timeStamp = timeStamp;
		this.type = type;
		this.state = state;
		this.position = new int[3];
		this.position = position;
		this.temperature = temperature;
		this.subtype = subtype;
		this.message = message;
		this.attribute = null;
		this.notified = false;
		this.setDate(new Date());
		this.setSource(source);
	}

	public String getAttribute() {
		return attribute;
	}

	public void setAttribute(String attribute) {
		this.attribute = attribute;
	}

	public long getTimeStamp() {
		return timeStamp;
	}

	public void setTimeStamp(long timeStamp) {
		this.timeStamp = timeStamp;
	}

	public EventType getType() {
		return type;
	}

	public void setType(EventType type) {
		this.type = type;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public int getTemperature() {
		return temperature;
	}

	public void setTemperature(int temperature) {
		this.temperature = temperature;
	}

	public String getSubtype() {
		return subtype;
	}

	public void setSubtype(String subtype) {
		this.subtype = subtype;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public int[] getPostion() {
		return position;
	}

	public void setPosition(int[] postion) {
		this.position = postion;
	}

	public boolean isNotified() {
		return notified;
	}

	public void setNotified(boolean notified) {
		this.notified = notified;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		String info = "TIME:" + timeStamp + ",";
		if (position != null) {
			info = info + "POSITION: rack" + position[0] + ", shelf"
					+ position[1] + ", slot" + position[2] + ",";
		}

		if (temperature != 0) {
			info = info + "TEMPERATURE:" + temperature + ",";
		}

		if (subtype != null) {
			info = info + "TYPE:" + subtype + ",";
		}

		if (message != null) {
			info = info + "MESSAGE:" + message + ",";
		}

		if (state != null) {
			info = info + "STATE:" + state;
		}

		info = info + ";";

		return info;
	}

	public String getSource() {
		return source;
	}

	public void setSource(String source) {
		this.source = source;
	}
}
